package com.bitdf.txing.group.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bitdf.txing.common.utils.PageUtils;
import com.bitdf.txing.group.dao.GroupRequestAddDao;
import com.bitdf.txing.group.entity.GroupRequestAddEntity;
import com.bitdf.txing.group.service.GroupRequestAddService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("groupRequestAddService")
public class GroupRequestAddServiceImpl extends ServiceImpl<GroupRequestAddDao, GroupRequestAddEntity> implements GroupRequestAddService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
//        IPage<GroupRequestAddEntity> page = this.page(
//                new Query<GroupRequestAddEntity>().getPage(params),
//                new QueryWrapper<GroupRequestAddEntity>()
//        );
//
//        return new PageUtils(page);
        return null;
    }

    /**
     * 同意加入组团
     *
     * @param id
     * @return
     */
    @Override
    public Boolean agree(Long id) {
        //修改状态
        GroupRequestAddEntity entity = this.getById(id);
        if (entity.getStatus() != 0) {
            return false;
        }
        entity.setStatus(1);
        this.updateById(entity);
        return true;
    }

    /**
     * 拒绝加入组团
     *
     * @param id
     * @return
     */
    @Override
    public Boolean reject(Long id) {
        //修改状态
        GroupRequestAddEntity entity = this.getById(id);
        if (entity.getStatus() != 0) {
            return false;
        }
        entity.setStatus(2);
        this.updateById(entity);
        return true;
    }
}